import time

class Logs:
    level = ['err', 'info', 'debug']

    def __init__(self,log_path,level):
        self.path = log_path
        self.level = level

    def getTime(self):
        return time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())

    def log_write(self, val):
        file = open(self.path, mode='a', encoding='utf-8')
        file.write(f'{time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())} [ {self.level} ] {val} \n')
        file.close()






